<!doctype html>
<html>

<head>
	<title></title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
	<link rel="stylesheet" href="../res/css/weui.css" />
	<link rel="stylesheet" href="../res/css/weuix.css" />
	<!-- <link rel="stylesheet" href="../res/css/common.css" /> -->
	<script src="../res/js/tim/trtc.js"></script>
	<script src="../res/js/zepto.min.js"></script>
	<script src="../res/js/zepto.weui.js"></script>
	<script src="../res/js/common.js?v=1"></script>
	<script src="../res/js/socket.js"></script>
	<script src="inquiry_chat.js?v=13"></script>

	<script src="../res/js/tim/purl.js"></script>
	<script src="../res/js/tim/vconsole.min.js"></script>
	<script src="../res/js/tim/GenerateTestUserSig.js"></script>
	<script src="../res/js/tim/lib-generate-test-usersig.min.js"></script>
	<script src="../res/js/tim/AgoraRTC_N-4.17.2.js"></script>
	<script src="../res/js/tim/swTRTC.js"></script>
	<script src="../res/js/tim/imBase.js"></script>
	 <script src="../res/js/consultationWebsocket.js"></script>
	<script>
		var log_id, isOnline, onlineNum = 0,
			endOpen, ossdata = [],
			Picdata, inquirypatientId, user_id, textList = "";
		var patientIM = getQst("patientIM"),
			oldDoctorName;
		var fileArr = [];
		var pop = 0; //判断是否popup过
		var first = 1; //判断是否第一次加载历史信息
		var tvflag = 0,
			truename = '',
			patientImg = '',
			doctorHeadImg = '';
		var Num = 0,
			score = 5;
		var ConditionListName = [];
		var ConditionName = '',
			isData = 0,
			patientIdcard = 1;
		var timeOutEvent = null;
		var fromMyDoctor = getQst("fromMyDoctor")
		var FeeInfomation = null; //付费信息
		var finishAsk = false;  //问诊结束
		var moveFlag = 0;	//滑动记录
		let firstMsg;
		let IOSterminal;

		let reShowFlag = ''		//弹窗打开记录
		$(function () {
			// 是IOS终端
			IOSterminal = /(iPhone|iPhone OS|Mac OS)/i.test(navigator.userAgent);
			//隐藏弹窗
			$(".darkBackgroud").hide();
			$(".popubBox").hide();
			$(".popubBox1").hide();

			// 判断是否TV端
			var tvflag = getQst("tvflag");
			if (tvflag == 1) {
				$('#videoDiv2').css({
					"display": "none"
				})
				$('#videoDiv1').attr({
					class: "bvideo"
				});
			} else {
				//什么都不做
			}

			log_id = getQst("log_id"); //logid问诊号
			log_type = getQst("log_type"); //问诊类型
			doctor_id = getQst("doctor_id"); //医生id
			console.log(doctor_id);
			doctor_imid = getQst("doctor_imid"); //医生im
			inquirypatientId = getQst("inquirypatientId"); //真正的问诊号（？
			patientIM = getQst("patientIM") //患者IM

			//判断是否为家庭医生或复诊
			if (log_type == 3 || log_type == 4) {
				//隐藏结束问诊按钮
				$("#btnEnd").hide()
			} else {
				//隐藏退款按钮
				$("#btnRefund").hide()
			}

			$("#btnRefund").on("click", function (e) {
				e.preventDefault();
				e.stopPropagation();
				$(".darkBackgroud").show();
				$(".popubBox").show();
			})

			$(".btn1").on("click", function (e) {
				e.preventDefault();
				e.stopPropagation();
				let params = {
					doctorId: doctor_id,
					isFrozen: 1
				}
				newAjaxPost("/h5/wxpay/refund", params, (json) => {
					msgInfo(json.msg);
					setTimeout(() => {
						window.location.replace(`doctor_home_page.htm?doctor_id=${doctor_id}`)
					}, 500)
				})
			})

			if (Number(log_type) == 1) {
				$(".darkBackgroud").show();
				$(".popubBox1").show();
			} else {
				$(".darkBackgroud").on("click", function (e) {
					e.preventDefault();
					e.stopPropagation();
					$(".darkBackgroud").hide();
					$(".popubBox").hide();
				})
			}

			$(".btn11").on("click", function () {
				TRTCTYPE === 'Tencent' ? createClient() : RTCjoin()
				$(".darkBackgroud").hide();
				$(".popubBox1").hide();
			})

			$(".btn2").on("click", function (e) {
				e.preventDefault();
				e.stopPropagation();
				$(".darkBackgroud").hide();
				$(".popubBox").hide();
			})



			calChatHeight();

			//初始化webscoket
			// 初始化webscoket
			// function initWebSocket() {
			// 	// 连接socket 重构的聊天要用到socket
			// 	var token = null;
			// 	var userJson = localStorage.getItem('DSXBuserJson');
			// 	user_id = strToJson(userJson).id
			// 	if (userJson) {
			// 		token = strToJson(userJson).h5Token
			// 	}
			// 	wsConnection.initWebSocket('wss://hospital-test.yixianmedical.com/websocket', token);
			// }
			// initWebSocket()

			// 获取自己的用户名
			// getMyInfo()

			//获取oss参数
			newOssPolicy()
			// console.log();

			getInquiryLogDetails();
			GetConditionList();
			getMeasureData();
			noticeDoctor();

			//患者加入聊天室通知对方
			function noticeDoctor() {
				parent.wsConnection.send(38, {
					userIm: patientIM, //发送方im
					friendIm: doctor_imid, //接收方im
					logId: log_id //问诊号
				});
			}

			// 上传图片
			$('#btnUpPic').on("click", function () {
				// 直接用websocket上传
				// 判断是否popup过
				if (finishAsk) {
					msgInfo('问诊已结束');
				} else {
					if (pop == 0) {
						pop++;
						window.removeEventListener("popstate", out, false);
						$('#upLoadimg').popup() //打开
						setTimeout(function () {
							window.addEventListener("popstate", out, false);
						}, 300);
					} else if (pop > 0) {
						pop = 0;
						window.removeEventListener("popstate", out, false);
						$.closePopup(); //关闭
						setTimeout(function () {
							window.addEventListener("popstate", out, false);
						}, 300);
					}
				}
			});
			//测量数据
			$('#takeOnData').on("click", function (e) {
				if (finishAsk) {
					msgInfo('问诊已结束');
					return
				}
				e.preventDefault();
				e.stopPropagation();
				getMeasureData()
				// 判断是否popup过
				if (pop == 0) {
					pop++;
					window.removeEventListener("popstate", out, false);
					$('#dateWrite').popup() //打开
					setTimeout(function () {
						window.addEventListener("popstate", out, false);
					}, 300);
				} else if (pop > 0) {
					pop = 0;
					window.removeEventListener("popstate", out, false);
					$.closePopup(); //关闭
					setTimeout(function () {
						window.addEventListener("popstate", out, false);
					}, 300);
				}
			});

			//发送消息
			$('#btnSend').on("click", function () {
				// onSendMsg();
				if (finishAsk) {
					msgInfo('问诊已结束');
					//清空输入框
					$("#send_msg_text").val('');
				} else {
					var onemsg = '';
					var time = formatDate(new Date());
					var content = $("#send_msg_text").val();
					textList = $("#send_msg_text").val();
					if (content == '') {
						msgInfo('请先输入内容再发送');
						return;
					}
					parent.wsConnection.send(parent.dataType.msgRequest, {
						'msgText': content, // 信息体
						'friendId': doctor_imid, // 医生imID
						'inquiryLogId': log_id,
						'msgusername': truename,
						'msgType': 0,
						'msgDate': time
					});
					//清空输入框
					$("#send_msg_text").val('').focus();
				}
			});

			// 唤起键盘时 滚动到聊天记录底部
			$("#send_msg_text").on('focus', e => {
				scrollBottom()
			})

			//病历中心
			$('#btnRecord').on("click", function (e) {
				reShowFlag = 'record'
				e.preventDefault();
				e.stopPropagation();
				getInquiryLogDetails()
				if (pop == 0) {
					pop++;
					window.removeEventListener("popstate", out, false);
					$('#divRecord').popup() //打开
					setTimeout(function () {
						window.addEventListener("popstate", out, false);
					}, 300);
				} else if (pop > 0) {
					pop = 0;
					window.removeEventListener("popstate", out, false);
					$.closePopup(); //关闭
					setTimeout(function () {
						window.addEventListener("popstate", out, false);
					}, 300);
				}
			});

			//结束问诊
			$('#btnEnd').on("click", function (e) {
				reShowFlag = 'end'
				$("#divEndInquiry").removeClass('weui-popup__container--visible')
				e.preventDefault();
				e.stopPropagation();
				getInquiryLogDetails();
				window.removeEventListener("popstate", out, false);
				$("#divEndInquiry").popup(); //打开
				setTimeout(function () {
					window.addEventListener("popstate", out, false);
				}, 300);
			});

			//确认结束问诊
			$('#btnEndOk').on("click", function () {
				if(endInquiry()){//结束提交评论
					pauseVideo(); //发送结束问诊socket和关闭视频
					// outOfIFrame('recipe_list.htm')
					location.replace('recipe_list.htm')
				};
			});

			//取消确认结束问诊 ---2020/4/10
			$('#btnEndCancel').on("click", function () {
				$.closePopup(); //关闭
				$("#btnEnd").removeClass('weui-bar__item--on');
			});

			//处方流转功能
			$('#btnBuyOrder').on("click", function () {
				window.open('http://zz.nxk520.com/netcflz_wx/user_dtl1.htm?prescription_id=' +
					prescription_id);
			});

			//病例关闭  ---2020/4/10
			$(".close-popup-btn").on("click", function () {
				pop = 0;
				$.closePopup(); //关闭
				$("#btnRecord").removeClass('weui-bar__item--on');
				$("#btnRecord").removeClass('weui-popup__container--visible')
			})

			$(".close-popup_photo").on("click", function () {
				$.closePopup(); //关闭
				// $("#btnUpPic").removeClass('weui-bar__item--on');
			})

			$('body').on('touchmove', '.slidebg', function () {
				$(document.body).on('touchmove.prevUC', function (e) {
					e.preventDefault();
				});
			});
			$('body').on('touchend', '.slidebg', function () {
				$(document.body).off('touchmove.prevUC');
			});
			//医生掉线弹窗
			$('.Refeedialog').on('click', function () {
				$('#androidDialog1').fadeIn(200);
				$('.fee_mask').addClass('weui-mask--visible');
				$('.fee_dialog').addClass('weui-dialog--visible');
			})
			$('.weui-dialog__btn_primary').on('click', function () {
				Refee()
			})
			$('.weui-dialog__btn_default').on('click', function () {
				$('#androidDialog1').fadeOut(200);
			})
			$('.backIndex').on('click', function () {
				var isIos = checkWxAndIos();
				if (isIos && getQst("log_type") == '1') {
					goPage('inquiry_skip.htm')
				} else {
					goPage("inquiry_doctor_index.htm");
				}
			})
			$('.toWait').on('click', function () {
				parent.wsConnection.send(parent.dataType.fiveMinWait, {
					"doctorId": doctor_id, //医生id
					"patientIM": patientIM, //患者im
				});
				$('.weui-mask').removeClass('weui-mask--visible')
				$('.weui-dialog').removeClass('weui-dialog--visible')
			})

			// =========================

			// 点击其他地方收起撤回按钮
			$('body').on('touchstart', function () {
				$('.delete_btn').hide()
			})


			// 点击遮罩层关闭大图
			$(".close_img").on('touch', function () {
				$('.img_mask').removeClass('weui-mask--visible')
				$('.img_dialog').removeClass('weui-dialog--visible')
			})

			// document.addEventListener('contextmenu', e => {
			// 	e.preventDefault()
			// 	return false
			// })
			$("body").on('contextmenu', function (e) {
				e.preventDefault()
			})

			$("#dataAnimalHeat").on('input', inputLimit(2))
			$("#dataRr").on('input', inputLimit(0))
			$("#dataSbp").on('input', inputLimit(0))
			$("#dataDbp").on('input', inputLimit(0))
			$("#dataHeartRate").on('input', inputLimit(0))
			$("#dataGlu").on('input', inputLimit(2))
		});

		function inputLimit(limit) {	//限制输入小数点后位数
			let reg =
				limit ? new RegExp(`\\d+(\\.\\d{0,${limit}})?`)
					: new RegExp('\\d+')
			return function (e) {
				let $this = $(this),
					$val = $this.val(),
					validata = reg.exec($val)

				$this.val(validata ? validata[0] : '')
			}
		}

		function scrollBottom(){
			let list = document.getElementById('chat_Log')
			if (list.lastChild) {
				let timmer = setTimeout(() => {
					list.lastChild.scrollIntoView()
					clearTimeout(timmer)
				}, 100);
			}
		}

		//获取用户信息
		function getMyInfo() {
			newAjaxPost("/h5/userInfo/userInfo", {}, getMyInfoOk);
		}

		function getMyInfoOk(res) {
			var userInfo = res.data;
			truename = isSpace(userInfo.trueName) ? "未设置" : userInfo.trueName
		}

		// 输入法遮掩聊天板内容（未解决
		// $(window).resize(function () {
		// 	calChatHeight();
		// });

		window.onload = function () {
			/*禁止ios缩放，双击和双指*/
			document.addEventListener('touchstart', function (event) {
				if (event.touches.length > 1) {
					event.preventDefault();
				}
			});
			var lastTouchEnd = 0;
			document.addEventListener('touchend', function (event) {
				var now = (new Date()).getTime();
				if (now - lastTouchEnd <= 300) {
					event.preventDefault();
				}
				lastTouchEnd = now;
			}, false);
			document.addEventListener('gesturestart', function (event) {
				event.preventDefault();
			});
		}

		if (log_type == 1 || log_type == 2) {
			pushHistory();
		}
		window.addEventListener("popstate", out, false);

		function pushHistory() {
			var state = {
				title: "title",
				url: "#"
			};
			window.history.pushState(state, "title", "#");
		}

		//用户点击返回提示评价(家庭医生复诊不用)
		function out() {
			// window.location.replace(document.URL);
			if (log_type == 1 || log_type == 2) {
				$.confirm({
					title: '温馨提示',
					text: '您正在问诊中，确定要离开吗？(确定评分后离开)',
					onOK: function () {
						pushHistory();
						$("#divEndInquiry").removeClass('weui-popup__container--visible')
						$("#divEndInquiry").popup();
					},
					onCancel: function () {
						pushHistory();
					}
				});
			} else {

			}
			// alert("我监听到了浏览器的返回按钮事件啦");//根据自己的需求实现自己的功能
		}

		function pauseVideo() {
			parent.wsConnection.send(parent.dataType.patientEnd, {
				logId: log_id // 本次问诊ID
			});
			sessionStorage.removeItem('TRTCset');
			// RTCleave()
			setTimeout(function(){
				goPage("recipe_list.htm")
			},1000)
			//    stream.getVideoTracks()[0].stop();
		}

		function newOssPolicy() {
			newAjaxPost("/h5/oss/ossPolicy", {}, newOssPolicyOk);
		}

		function newOssPolicyOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				ossdata = jsonInfo.data
			}
		}
		// getSuffix() 方法用于获取文件名的后缀
		var getSuffix = function (fileName) {
			var pos = fileName.lastIndexOf(".");
			var suffix = '';
			if (pos != -1) {
				suffix = fileName.substring(pos);
			}
			return suffix;
		};
		//上传图片
		function newUpdateUserHeadImg(data) {
			var onemsg = '';
			var time = formatDate(new Date());
			// 在聊天室中显示
			parent.wsConnection.send(parent.dataType.msgRequest, {
				msgText: data.filename, // 信息体
				friendId: doctor_imid, // 医生imID
				inquiryLogId: log_id,
				msgusername: truename,
				msgType: 3,
				msgDate: time
			});
			pop = 0;
			window.removeEventListener("popstate", out, false);
			$.closePopup(); //关闭
			setTimeout(function () {
				window.addEventListener("popstate", out, false);
				$("#uploaderFiles").html('');
				$(".weui-uploader__input-box").show()
				Picdata = '';
			}, 300);
		}

		// ws监听
		parent.wsConnection.onMessage = function (msg) {
			// todo 判断数据包类型进行后续处理 dataType
			console.log(msg);
			// console.log('接收到一条ws信息');
			var onemsg = '';
			if (msg.packageType == 3) { //接收自己的聊天信息事件

				if (!firstMsg) {
					// 记录第一次发消息的时间
					firstMsg = new Date(
						IOSterminal ? msg.msgDate.replace(/\-/g, '/')
						: msg.msgDate
					).getTime()
				}

				if (msg.msgType == 4) { //自己撤回信息

				} else if (msg.msgType == 3) { //自己发图片
					onemsg += `
						<div class="onemsgUser notRead" style="display: flex; flex-direction: row-reverse; margin-right: 5px;" id="${msg.id}" type="${msg.msgType}" msgDate="${msg.msgDate}">
							<div class="msgImgDiv" style="padding: 16px 0px;">
								<img class="msgImg" src = "${patientImg}" style="width: 30px;"/>
							</div>
							<div class="msgPDiv" style="background: #2b73cc; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px; max-width: 70%;position: relative;">
								<p class="msghead" style="color:white;">[${patientName}] ${msg.msgDate}</p>
								<p class="msgbody">
									<img class="msgImg openBig" src="${msg.msgText}"/>
								</p>
								<div class="delete_btn" id="id${msg.id}" num="${msg.id}" date="${msg.msgDate}">撤回</div>
							</div>
						</div>`
				} else if (msg.msgType == 0) { //自己发消息
					onemsg += `
						<div class="onemsgUser notRead" style="display: flex; flex-direction: row-reverse;  margin-right: 5px;" id="${msg.id}" type="${msg.msgType}" msgDate="${msg.msgDate}">
							<div class="msgImgDiv" style="padding: 16px 0px;">
								<img class="msgImg" src = "${patientImg}" style="width: 30px;"/>
							</div>
							<div class="msgPDiv" style="background: #2b73cc; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px; max-width: 70%;position: relative;">
								<p class="msghead" style="color:white;">[${patientName}] ${msg.msgDate}</p>
								<p class="msgbody">
									<pre style="white-space: pre-wrap; white-space:pre-line; word-wrap: break-word; width: 100%; overflow: hidden;color:white;">${msg.msgText}</pre>
								</p>
								<div class="delete_btn" id="id${msg.id}" num="${msg.id}" date="${msg.msgDate}">撤回</div>
							</div>
						</div>`
				}
				// msgType: 0							// 消息类型；0文字消息、1固定表情 3 图片url
				// userId: 10							// 来信的IM id
				var msgflow = document.getElementById("divChatMain");
				$("#chat_Log").append(onemsg);

				// 300ms后,等待图片加载完，滚动条自动滚动到底部
				setTimeout(function () {
					msgflow.scrollTop = msgflow.scrollHeight;
				}, 300);

				//弹出撤回选项 =============================================================
				$('.onemsgUser .msgPDiv').off().on({
					touchstart: function (e) {
						// 手指按下 开始计时弹出撤回按钮
						let $this = $(this).parent(),
							touch_id = $this.attr('id'),
							msgDate = $this.attr('msgDate'),
							sendTime = new Date(
								IOSterminal ? msgDate.replace(/\-/g, '/')
								: msgDate
							).getTime()

						moveFlag = 0	// 初始化标记变量
						clearTimeout(timeOutEvent);
						timeOutEvent = setTimeout(function () {
							$(".delete_btn").hide()

							if(sendTime >= firstMsg){
								$('#id' + touch_id).show()
							}

							moveFlag++	// 添加标记
						}, 600);
						setTimeout(() => {
							e.preventDefault()
							// msgInfo('img touch start')
						}, 300);
					},
					touchmove: function () {
						// 手指移动 清除计时器 和 添加标记
						clearTimeout(timeOutEvent);
						moveFlag++
					},
					touchend: function (e) {
						// 抬手 清除计时器 如果有标记 阻止默认事件(浏览器菜单)
						clearTimeout(timeOutEvent);
						if(moveFlag){
							e.preventDefault()
							return false
						}
					}
				})

				// 撤回功能 ================================================================
				$('.onemsgUser .delete_btn').off().on({
					touchstart: function (e) {
						// 按下撤回按钮时阻止事件传播 防止撤回按钮被收起
						moveFlag = 0	// 初始化标记
						e.stopPropagation()
					},
					touchmove: function (e) {
						//  触碰撤回按钮后移动 添加标记
						moveFlag++
					},
					touchend: function (e) {
						// 在撤回按钮中抬手撤回消息 如果有标记则不执行
						if(moveFlag) { return }

						var id = $(this).attr('num');
						var date = $(this).attr('date');
						var time = formatDate(new Date());
						var onemsguser = ''

						// ios需要识别的年月日格式为 xxxx/xx/xx
						if(IOSterminal){
							let reg = /\-/g
							time = time.replace(reg, '/')
							date = date.replace(reg, '/')
						}

						if (Date.parse(time) - Date.parse(date) < 120000) {
							parent.wsConnection.send(parent.dataType.msgRequest, {
								id: id,
								msgText: truename + '撤回了一条信息', // 信息体
								friendId: doctor_imid, // 医生imID
								inquiryLogId: log_id,
								msgType: 4,
								msgDate: time.replace(/\//g, '-'),
								msgUserName: truename
							});
							onemsguser +=`
								<div class="msgPDiv" style="background: #EFF3F4; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px auto;text-align: center; font-size: 12px; width: 60%">
									<pre style="white-space: pre-wrap; white-space:pre-line; word-wrap: break-word; overflow: hidden;">
										${truename}撤回了一条信息
									</pre>
								</div>`;

							let deleteTimmer = setTimeout(function() {
								$('#' + id).html(onemsguser).removeClass('notRead').removeClass('isRead')
								clearTimeout(deleteTimmer)
								deleteTimmer = undefined
							}, 100);
						} else {
							msgInfo('消息发出超过两分钟，禁止撤回！');
							$(".delete_btn").hide()
						}
						e.stopPropagation()
					}
				})

			} else if (msg.packageType == 4) { //接收聊天信息事件
				if (msg.msgType == 5) { //系统消息
					onemsg += `
						<div class="onemsg" style="width: 98%;padding-left: 5px;" id="${msg.id}">
							<div class="msgPDiv" style="background: #EFF3F4; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px auto;text-align: center; font-size: 12px; max-width: 60%;">
									<pre style="white-space: pre-wrap; white-space:pre-line; word-wrap: break-word; width: 100%; overflow: hidden;">${msg.msgText}</pre>
							</div>
						</div>`

					getInquiryLogDetails()
				}
				else if (msg.msgType == 4) {	//对方撤回消息时
					// 将文字消息中的'xxx医生'替换成 '对方'
					let nameReg = new RegExp(msg.msgUserName + '(医生)?')
					let myTempl = `
						<div class="msgPDiv" style="background: #EFF3F4; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px auto;text-align: center; font-size: 12px; width: 60%">
							<pre style="white-space: pre-wrap; white-space:pre-line; word-wrap: break-word; overflow: hidden;">
								${msg.msgText.replace(nameReg, '对方')}
							</pre>
						</div>`
					$('#' + msg.id).html(myTempl)
				}
				else if (msg.msgType == 8) {
					$('.notRead').removeClass('notRead').addClass('isRead')
				} else if (msg.msgType == 7) {
					getHistoryMsg()
					$("#btnRefund").hide()
					// $('#btnEnd').show()
				} else { //医生消息
					if(msg.msgType != 6){
						//发送39报确认已读
						parent.wsConnection.send(39, {
							"userId": doctor_imid, //发送方id
							"friendId": patientIM //接收方id
						})
					}
					if (msg.userId == doctor_imid) {
						if (msg.msgType == 0) { //医生发文字
							onemsg += `
								<div class="onemsg" style="display: flex; width: 98%;padding-left: 5px;" id="${msg.id}">
									<div class="msgImgDiv" style="padding: 16px 0px;">
										<img class="msgImg" src = "${doctorHeadImg}" style="width: 30px;"></img>
									</div>
									<div class="msgPDiv" style="background: #EFF3F4; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px; max-width: 70%;">
										<p class="msghead" style="color:black;">[${msg.nickname}] ${msg.msgDate}</p>
										<p class="msgbody">
											<pre style="white-space: pre-wrap; white-space:pre-line; word-wrap: break-word; width: 100%; overflow: hidden;">${msg.msgText}</pre>
										</p>
									</div>
								</div>`
						} else if (msg.msgType == 3) {
							onemsg += `
								<div class="onemsg" style="display: flex; width: 98%;padding-left: 5px;" id="${msg.id}">
									<div class="msgImgDiv" style="padding: 16px 0px;">
										<img class="msgImg" src = "${doctorHeadImg}" style="width: 30px;"></img>
									</div>
									<div class="msgPDiv" style="background: #EFF3F4; border: 1px solid #EFF3F4; border-radius: 7px; padding: 4px; margin: 7px; max-width: 70%;">
										<p class="msghead" style="color:black;">[${msg.nickname}] ${msg.msgDate}</p>
										<p class="msgbody">
											<img class="msgImg openBig" src="${msg.msgText}" style="width:200px"></img>
										</p>
									</div>
								</div>`
						}
					}
				}
				// msgType: 0							// 消息类型；0文字消息、1固定表情 3 图片url
				// userId: 10							// 来信的IM id
				var msgflow = document.getElementById("divChatMain");
				$("#chat_Log").append(onemsg);

				$(".goList").click(function () {
					goPage("my_prescription_list.htm?logId=" + log_id)

				})

				// 300ms后,等待图片加载完，滚动条自动滚动到底部
				setTimeout(function () {
					msgflow.scrollTop = msgflow.scrollHeight;
					$(".openBig").off().on('click', function () {
						console.log(1)
						var imgsrc = $(this)[0].src
						$('.show').attr('src', imgsrc)
						$('.img_mask').addClass('weui-mask--visible');
						$('.img_dialog').addClass('weui-dialog--visible');
					})
				}, 300);
			} else if (msg.packageType == 9 || msg.packageType == 23) { //对方已离线事件
				if (log_type == 1 || log_type == 2) {
					$('.doctor_mask').addClass('weui-mask--visible')
					$('.doctor_dialog').addClass('weui-dialog--visible')
					$('.fee_mask').addClass('weui-mask--visible')
					$('.fee_dialog').addClass('weui-dialog--visible')
				} else {

				}
			} else if (msg.packageType == 14) { //本次问诊结束广播
				getInquiryLogDetails();
				finishAsk = true
				//医生结束问诊
				if (msg.imId == doctor_imid) {
					msgInfo('医生已结束问诊');
				}
				if (log_type == 1 || log_type == 2) {
					if($("#divEndInquiry").css('display') == 'none'){
						$("#divEndInquiry").popup(); //打开`
						reShowFlag = 'end'
					}
					if(log_type == 1){
						TRTCTYPE === 'Tencent' ? leaveRoom(client) : swleave()
					}
				} else {
					getHistoryMsg()
				}
			} else if (msg.packageType == 16) { //医生分诊患者成功后的广播
				newRefee()
				$.alert({
					title: '提示',
					text: '医生已分诊，当前问诊费会在1-3工作日内原路返回',
					onOK: function () {
						var isIos = checkWxAndIos();
						if (isIos && getQst("log_type") == '1') {
							goPage('inquiry_skip.htm')
						} else {
							goPage("inquiry_doctor_index.htm");
						}
						// goPage("inquiry_doctor_index.htm");
					}
				});
			} else if (msg.packageType == 17) { //医生修改问诊内                           容-病历部分
				getInquiryLogDetails();
			} else if (msg.packageType == 18) { //医生修改问诊内容-住院建议
				getInquiryLogDetails();
			} else if (msg.packageType == 25 || msg.packageType == 27) { //医生拒绝重连或者患者等待5分钟后医生未重连
				if (log_type == 1 || log_type == 2) {
					$.modal({
						title: '温馨提示',
						text: '医生未能重连成功，请返回首页选择其他医生。',
						buttons: [{
								text: "结束问诊",
								onClick: function () {
									$.confirm({
										title: '温馨提示',
										text: '您确定要退诊查费吗？当前问诊费会在1-3个工作日原路返回，请耐心等候',
										onOK: function () {
											Refee()
										},
										onCancel: function () {}
									});
								}
							},
							{
								text: "返回首页",
								onClick: function () {
									parent.wsConnection.send(parent.dataType.patientEnd, {
										logId: log_id // 本次问诊ID
									});
									var isIos = checkWxAndIos();
									if (isIos && getQst("log_type") == '1') {
										goPage('inquiry_skip.htm')
									} else {
										goPage("inquiry_doctor_index.htm");
									}
								}
							}
						],
					});
				} else {}
			} else if (msg.packageType == 28) { //通知患者医生已经上线
				$('.weui-mask').removeClass('weui-mask--visible')
				$('.weui-dialog').removeClass('weui-dialog--visible')
			} else if (msg.packageType == 30) { //
				console.log(30);
			}
		};
		/**
		 * TODO
		 * 会诊监听
		 * @param msg
		 */
		parent.consultationSocket.onMessage = function (res) {
			console.log(res, '会诊消息数据chat');
			switch (res.code) {
				case 1:
					sessionStorage.setItem('cTencentConfig',  jsonToStr({
						room: res.roomId + '',
						...(res.configuration || {})
					}))
					break;
				case 3: // 会诊开始
					handleConsultationStart(res);
					break;
				case 6: // 医生离开
					handleConsultationEnd(res);
					break;
				default:
					// 其他消息类型
					break;
			}
		}
		//医生掉线时，退费
		function Refee() {
			var params = {
				"doctorId": doctor_id,
				"isFrozen": 1
			}
			newAjaxPost("/h5/wxpay/refund", params, RefeeOk);
		}

		function RefeeOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				msgInfo('退费成功，请重新选择医生问诊');
				var isIos = checkWxAndIos();
				if (isIos && getQst("log_type") == '1') {
					goPage('inquiry_skip.htm')
				} else {
					goPage("inquiry_doctor_index.htm");
				}
			}
		}
		//收到分诊时，退费
		function newRefee() {
			var params = {
				"doctorId": doctor_id,
				"isFrozen": 1
			}
			newAjaxPost("/h5/wxpay/refund", params, newRefeeOk);
		}

		function newRefeeOk(jsonInfo) {
			if (jsonInfo.code == 1) {
				// msgInfo('退费成功，请重新选择医生问诊');
			}
		}

	</script>
	<style>
		html {
			touch-action: none;
			touch-action: pan-y;
		}

		body{
			display: flex;
			flex-direction: column;
			height: 100vh;
			overflow: auto;
		}

		#divChatMain{
			overflow: auto;
			flex-grow: 1;
		}

		.onemsgUser{
			user-select: none;
			-webkit-user-select: none;
		}

		.weui-cells {
			font-size: 14px;
		}

		.header {
			text-align: center;
			z-index: 1;
			width: 100%;
			top: 0;
			transition: 0.5s;
		}

		.input_msg {
			width: 95%;
			display: inline-block;
			height: 25px;
			border: 0.5px solid #d8d8d8;
			line-height: 25px;
			border-radius: 4px;
			padding: 2.5px;
			text-align: left;
		}

		.weui-form-li {
			vertical-align: middle;
			position: relative;
			margin: 0 0px 0 5px
		}

		.weui-form-text {
			display: inline-block;
			position: relative;
			margin-top: 0px;
			margin-right: 0px;
			cursor: pointer;
			font-size: 14px
		}

		.weui-icon-radio {
			-webkit-border-radius: 100%;
			border-radius: 100%;
			width: 11px;
			height: 11px;
			display: inline-block;
			margin-top: 4px;
			margin-right: 0px;
			border: 1px solid #b8b8b8;
			background-color: #fafafa;
			vertical-align: top;
		}

		.font14 {
			font-size: 14px;
			line-height: 20px
		}

		.mright15 {
			margin-right: 15px
		}

		.msgbody pre {
			white-space: pre-wrap
		}

		.onemsgUser .msgbody img{
			width: 100%;
			max-height: 400px;
			vertical-align: middle;
			-webkit-touch-callout: none;
			/* pointer-events: none; */
		}

		.chat_box{
			overflow: auto;
			width: 100vw;
		}

		.chat_box div p {
			font-size: 14px;
			line-height: 20px
		}

		.height150 {
			height: 150px
		}

		.svideo {
			position: absolute;
			width: 85px;
			margin-top: 5px;
			;
			height: 120px;
			right: 0
		}

		.svideo video {
			width: 80px;
			height: 90px;
			;
			object-fit: fill
		}

		.bvideo {
			position: absolute;
			width: 100%;
			/* margin-left: 23%; */
			height: 100%;
			float: right
		}

		.bvideo video {
			width: 100%;
			height: 100%;
			object-fit: fill
		}

		.width33 {
			width: 33.333%
		}

		.footer {
			background-color: White
		}

		.footer .bottom-tab{
			display: flex;
		}

		.weui-uploader__input-box {
			margin-top: 30px;
		}

		.weui-icon-delete .weui-icon_gallery-delete {
			color: #FFFFFF;
			font-size: 36px;
			line-height: 81px;
		}

		.weui-gallery__del {
			display: block;
			padding-bottom: 18px;
		}

		.ending {
			margin: 10%;
			margin-bottom: 70%;
			width: 80%;
			border-radius: 5px;
		}

		.toolbar {
			background: #ffffff;
			box-shadow: #999 0 0 5px -2px;
		}

		.weui-btn:after {
			content: none;
		}

		.btn_end {
			background-color: #ffffff;
			color: #0066FF;
			font-size: 20px;
		}

		.endtitle {
			position: absolute;
			display: block;
			width: 100%;
			padding: 0;
			font-size: .85rem;
			font-weight: normal;
			line-height: 2.2rem;
			color: #3d4145;
			text-align: center;
			white-space: nowrap;
		}

		.nav {
			width: 100%;
		}

		.nav li {
			height: 30px;
			width: 20%;
			list-style: none;
			float: left;
		}

		.nav li a {
			width: 24px;
			position: absolute;
			text-decoration: none;
			display: inline-block;
			text-indent: -99999px;
			background: url(../res/images/star-off-big.png) no-repeat;
			z-index: 10;
		}

		.star a {
			background: url(../res/images/star-on-big.png) no-repeat !important;
		}

		.weui-header {
			padding: 0 0;
		}

		.fontRed {
			color: red;
		}

		.recordList>div {
			background: white;
			margin: 10px;
			border-radius: 5px;
		}

		.weui-btn_primary {
			background-color: #1189ff;
		}

		.weui-tabbar__item.weui-bar__item--on .weui-tabbar__label {
			color: #1189ff;
		}

		.weui-cell {
			padding: 4px 10px;
		}

		.weui-tabbar__item {
			padding: 0;
		}

		.weui-tabbar {
			background-color: #ffffff;
		}

		.weui-tabbar:before {
			border-top: 0px;
		}

		.expertlist_map {
			border-radius: 5px;
			margin: 10px;
			box-shadow: 0px 0px 3px #888888;
		}

		.expertlist_map_top {
			display: flex;
			padding: 10px;
		}

		.expertlist_map_top>div.doctor_info {
			flex: 4;
			padding-left: 8px;
		}

		.expertlist_map_img {
			text-align: center;
			color: #f9a821;
		}

		.expertlist_map_img.color999 {
			color: #999;
		}

		.expertlist_map_img img {
			width: 58px;
			height: 58px;
			border-radius: 50%;
			display: block;
		}

		.doctor_name {
			font-size: 16px;
			font-weight: 500;
			padding-bottom: 3px;
			line-height: 27px
		}

		.doctor_name span:first-child {
			background-color: #ECF6FF;
			color: #1189FF;
			width: 60px;
			height: 19px;
			border-radius: 5px;
			font-size: 13px;
			padding: 2px 5px;
			margin: 0 5px;
		}

		.doctor_name span:last-child {
			background-color: #FEF8EE;
			color: #ECA02C;
			width: 60px;
			height: 19px;
			border-radius: 5px;
			font-size: 13px;
			padding: 2px 5px;
		}

		.age {
			font-size: 14px;
			color: #666;
			margin: 3px 0;
		}

		#start {
			color: black;
		}

		#start span {
			color: #1189ff;
		}

		.img_dialog {
			max-width: unset;
			width: 100%;
			top: 50%;
		}

		.show {
			width: 100%;
		}

		.weui-mask_transparent {
			z-index: 3000
		}

		.showChat {
			padding: 2px;
			border: 1px solid #1189ff;
			border-radius: 5px;
			background-color: #ECF6FF;
		}

		#dateWrite .weui-cell__hd {
			width: 24%;
			height: 40px;
			line-height: 40px;
			font-size: 14px;
		}

		#dateWrite .weui-cell__bd {
			width: 73%;
			height: 40px;
			line-height: 40px;
			font-size: 14px;
		}

		.weui-input {
			width: 77%;
		}

		.inline {
			display: inline-block;
		}

		.line {
			border-bottom: 1px solid #E0E0E0;
		}

		.line:last-child {
			border-bottom: 0px;
		}

		.dataShow .line {
			padding: 5px 0;
		}

		.dataShow .weui-cell__hd {
			min-width: 144px;
		}

		.select_img {
			width: 20px;
			top: 10px;
			position: absolute;
		}

		.delete_btn {
			display: none;
			position: absolute;
			/* bottom: 0px; */
			left: 40%;
			top: 1px;
			padding: 8px 12px;
			background-color: rgba(255, 255, 255, .7);
			border-radius: 6px;
			line-height: 1;
			white-space: nowrap;
			font-size: 14px;
			border: 1px solid #e0e0e0;
		}

		.weui-dialog__btn {
			font-size: 14px;
		}

		#androidDialog1 .weui-mask {
			z-index: 2000;
		}


		/* 弹出框样式 */
		.popubBox {
			width: 70%;
			display: none;
			background-color: #fff;
			position: fixed;
			top: 250px;
			left: 15%;
			z-index: 100;
			border-radius: 10px;
			z-index: 10000;
		}

		.popubBox1 {
			width: 70%;
			display: none;
			background-color: #fff;
			position: fixed;
			top: 250px;
			left: 15%;
			z-index: 1000;
			border-radius: 10px;
			z-index: 10000;
		}

		.title {
			width: 100%;
			height: 40px;
			line-height: 40px;
			text-align: center;
			font-family: PingFang SC;
			font-weight: bold;
			color: #353535;
			font-size: 20px;
			margin: 10px;
		}

		.titleMessage {
			width: 90%;
			margin: 30px 5%;
			font-size: 16px;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			text-align: center;
		}

		.btnList {
			width: 90%;
			margin: 15px 5%;
			display: flex;
		}

		.btn1 {
			width: 45%;
			margin: 0 2.5%;
			font-size: 14px;
			font-family: PingFang SC;
			font-weight: 500;
			color: #1189FF;
			background-color: #fff;
			text-align: center;
			line-height: 40px;
			height: 40px;
			border: 2px solid #03A6FF;
			border-radius: 20px;
		}

		.btn11 {
			width: 95%;
			margin: 0 2.5%;
			font-size: 14px;
			font-family: PingFang SC;
			font-weight: 500;
			color: #1189FF;
			background-color: #fff;
			text-align: center;
			line-height: 40px;
			height: 40px;
			border: 2px solid #03A6FF;
			border-radius: 20px;
		}

		.btn2 {
			width: 45%;
			margin: 0 2.5%;
			font-size: 14px;
			font-family: PingFang SC;
			font-weight: 500;
			color: #fff;
			background-color: #1189FF;
			border-radius: 10px;
			text-align: center;
			line-height: 40px;
			height: 40px;
			border: 2px solid #1189FF;
			border-radius: 20px;
		}

		.my-require::before{
			content: "*";
			color: red;
			padding-right: 2px;
		}
		.a-piece{
			margin: 10px 0;
			box-shadow: #999 0 0 5px -2px;
			flex-direction: column;
			align-items: flex-start;
		}
		.a-piece > div{
			padding-bottom: 8px;
		}
		.a-piece > div:last-child{
			padding-bottom: 0;
		}
		.score-row{
			display: flex;
			flex-direction: column;
			align-items: flex-start;
		}
		hr{
			width: 100%;
		}

		.tell-us-something textarea{
			width: 228px;
			padding: 0 2px;
			line-height: 20px;
			min-height: 20px;
			max-height: 73px;
			min-width: 180px;
			max-width: 279px;
			border-radius: 4px;
		}

		#divCameraMic{
			visibility: hidden;
		}

		#divEndInquiry .weui-footer{
			position: sticky;
			position: -webkit-sticky;
			bottom: 0;
		}

		.notRead::after{
			padding-top: 15px;
			content: '未读';
			color: red;
		}
		.isRead::after{
			padding-top: 15px;
			content: '已读';
			color: #393939;
		}
		.box-end{
			padding: 15px;
			box-shadow: #8885 0 0 4px 0px;
		}

		.onlineRecipe{
			display: none;
		}

		.msgImg{
			max-width: 100%;
		}
	</style>

<body ontouchstart>
	<div class="weui-header" id="divCameraMic" style="width:100%;z-index:-1;height: 240px;   background-color: black; flex-shrink: 0;">
		<div id="videoDiv2" class="bvideo"></div>
		<div id="videoDiv1" class="svideo"></div>
	</div>
	<div id="divChatMain">
		<div id="divChatLog">
			<div id="chat_Log" class="chat_box">
			</div>
		</div>
	</div>
	<div class="footer">
		<div class="weui-cell">
			<div class="weui-cell__bd"><input id="send_msg_text" class="input_msg" type="text" placeholder="请输入文字再发送" />
			</div>
			<div class="weui-cell__ft"><button id="btnSend" class="weui-btn weui-btn_mini weui-btn_primary">发送</button>
			</div>
		</div>
		<!-- 导航 -->

		<div class="bottom-tab">
			<a href="#" class="weui-tabbar__item" id="takeOnData">
				<img src="../res/images/inquiry_chat00.png" style="width: 38px;" />
				<p class="weui-tabbar__label">测量数据</p>
			</a>
			<a href="#" class="weui-tabbar__item" id="btnUpPic">
				<img src="../res/images/inquiry_chat02.png" style="width: 38px;" />
				<p class="weui-tabbar__label">上传图片</p>
			</a>
			<a href="#" class="weui-tabbar__item" id="btnRecord">
				<img src="../res/images/inquiry_chat01.png" style="width: 38px;" />
				<p class="weui-tabbar__label">病历中心</p>
			</a>
			<a href="#" class="weui-tabbar__item" id="btnEnd">
				<img src="../res/images/inquiry_chat03.png" style="width: 38px;" />
				<p class="weui-tabbar__label">结束问诊</p>
			</a>
			<a href="#" class="weui-tabbar__item" id="btnRefund">
				<img src="../res/images/icon_refund.png" style="width: 38px;" />
				<p class="weui-tabbar__label">退款</p>
			</a>
		</div>
	</div>
	<div id="divEndInquiry" class='weui-popup__container popup-bottom'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal" style="height: 80vh;">
			<div class="toolbar">
				<div class="toolbar-inner">
					<h1 class="title">请给服务您的医生评价</h1>
				</div>
			</div>
			<div class="modal-content">
				<div class="weui-cells weui-cells_form">
					<div class="weui-cell">
						<div class="weui-cell__hd font14 mright15">
							咨询医生：<span class="doctor_name"></span>
						</div>
						<div class="weui-cell__bd font14">
							医院：<span class="doctor_work_address"></span>
						</div>
					</div>

					<div class="weui-cell a-piece">
						<div class="score-row">
							<label class="font14 my-require">综合评分</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="pf" id="pf_1" value="1" type="radio" checked="checked">
									<label for="pf_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="pf" id="pf_2" value="2" type="radio">
									<label for="pf_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="pf" id="pf_3" value="3" type="radio">
									<label for="pf_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">一般</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="pf" id="pf_4" value="4" type="radio">
									<label for="pf_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">不满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="pf" id="pf_5" value="5" type="radio">
									<label for="pf_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常不满意</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14 my-require">服务质量评分</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zl" id="zl_1" value="1" type="radio" checked="checked">
									<label for="zl_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zl" id="zl_2" value="2" type="radio">
									<label for="zl_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zl" id="zl_3" value="3" type="radio">
									<label for="zl_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">一般</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zl" id="zl_4" value="4" type="radio">
									<label for="zl_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">不满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zl" id="zl_5" value="5" type="radio">
									<label for="zl_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常不满意</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14 my-require">服务态度评分</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="td" id="td_1" value="1" type="radio" checked="checked">
									<label for="td_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="td" id="td_2" value="2" type="radio">
									<label for="td_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="td" id="td_3" value="3" type="radio">
									<label for="td_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">一般</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="td" id="td_4" value="4" type="radio">
									<label for="td_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">不满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="td" id="td_5" value="5" type="radio">
									<label for="td_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常不满意</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14 my-require">系统使用评分</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="xt" id="xt_1" value="1" type="radio" checked="checked">
									<label for="xt_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="xt" id="xt_2" value="2" type="radio">
									<label for="xt_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="xt" id="xt_3" value="3" type="radio">
									<label for="xt_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">一般</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="xt" id="xt_4" value="4" type="radio">
									<label for="xt_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">不满意</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="xt" id="xt_5" value="5" type="radio">
									<label for="xt_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">非常不满意</div>
									</label>
								</div>
							</div>
						</div>

						<hr>
						<div class="my-require">医德医风</div>
						<div class="score-row">
							<label class="font14">1.尊重患者的权利，为患者保守医疗秘密</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zz" id="zz_5" value="5" type="radio" checked="checked">
									<label for="zz_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">5分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zz" id="zz_4" value="4" type="radio">
									<label for="zz_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">4分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zz" id="zz_3" value="3" type="radio">
									<label for="zz_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">3分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zz" id="zz_2" value="2" type="radio">
									<label for="zz_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">2分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zz" id="zz_1" value="1" type="radio">
									<label for="zz_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">1分</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14">2.文明礼貌、优质服务，构建和谐医患关系</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="wm" id="wm_5" value="5" type="radio" checked="checked">
									<label for="wm_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">5分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="wm" id="wm_4" value="4" type="radio">
									<label for="wm_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">4分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="wm" id="wm_3" value="3" type="radio">
									<label for="wm_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">3分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="wm" id="wm_2" value="2" type="radio">
									<label for="wm_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">2分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="wm" id="wm_1" value="1" type="radio">
									<label for="wm_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">1分</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14">3.遵纪守法、廉洁行医</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zj" id="zj_5" value="5" type="radio" checked="checked">
									<label for="zj_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">5分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zj" id="zj_4" value="4" type="radio">
									<label for="zj_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">4分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zj" id="zj_3" value="3" type="radio">
									<label for="zj_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">3分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zj" id="zj_2" value="2" type="radio">
									<label for="zj_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">2分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="zj" id="zj_1" value="1" type="radio">
									<label for="zj_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">1分</div>
									</label>
								</div>
							</div>
						</div>

						<div class="score-row">
							<label class="font14">4.因病施治，规范医疗服务行为</label>
							<div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="yb" id="yb_5" value="5" type="radio" checked="checked">
									<label for="yb_5">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">5分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="yb" id="yb_4" value="4" type="radio">
									<label for="yb_4">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">4分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="yb" id="yb_3" value="3" type="radio">
									<label for="yb_3">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">3分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="yb" id="yb_2" value="2" type="radio">
									<label for="yb_2">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">2分</div>
									</label>
								</div>
								<div class="weui-form-li iblock">
									<input class="weui-form-checkbox" name="yb" id="yb_1" value="1" type="radio">
									<label for="yb_1">
										<i class="weui-icon-radio"></i>
										<div class="weui-form-text">1分</div>
									</label>
								</div>
							</div>
						</div>
						<hr>

						<div class="tell-us-something score-row">
							<!-- class="my-require" -->
							<label for="commentDetail">评价内容</label>
							<textarea type="textarea" id="commentDetail" maxlength="500"></textarea>
						</div>
						<div class="tell-us-something score-row">
							<label for="complaint">投诉建议</label>
							<textarea type="textarea" id="complaint" maxlength="1000"></textarea>
						</div>
					</div>

					<div class="weui-cell onlineRecipe">
						<div class="weui-cell__hd font14">
							电子处方（点击下方按钮查看处方）
							<br />
							<span class="prescriptionListC">暂无处方列表</span>
						</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd font14">
							检验检查（点击下方按钮查看检验检查）
							<br />
							<span class="checklistListC">暂无数据</span>
						</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd font14">
							健康指导（点击下方按钮查看健康指导）
							<br />
							<span class="guidanceListC">暂无数据</span>
						</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd font14">
							申请单（点击下方按钮查看申请单）
							<br />
							<span class="formListResultC">暂无数据</span>
						</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__hd font14">
							住院建议（点击下方按钮查看住院建议）
							<br />
							<span class="hospitalizationListC">暂无数据</span>
						</div>
					</div>
					<div style="color:red" class="weui-cell">
						问诊结束后,请打开微信公众号查看病历和处方！
					</div>
				</div>
				<div class="weui-footer">
					<div class="weui-form__opr-area bg-white box-end">
						<button id="btnEndOk" class="weui-btn weui-btn_mini weui-btn_primary">提交评价</button>
						<!-- <span style="padding-left:50px"></span>
                    <button id="btnEndCancel" class="weui-btn weui-btn_mini weui-btn_primary">取消</button> -->
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--上传图片-->
	<div id="upLoadimg" class='weui-popup__container'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<div class="weui-cells weui-cells_form picform" style="overflow:auto">
				<div class="toolbar">
					<div class="toolbar-inner" style="    margin: 5px;">
						<!--<a href="javascript:;" class="picker-button close-popup">确定</a>-->
						<div class="weui-cell__bd font14"></div>
						<div class="weui-cell__ft"><a href="javascript:;"
								class="weui-btn weui-btn_mini weui-btn_primary close-popup_photo">关闭</a></div>
					</div>
				</div>

				<div class="weui-gallery" id="gallery">
					<span class="weui-gallery__img" id="galleryImg"></span>
				</div>
				<div class="weui-cells weui-cells_form">
					<div class="weui-cell">
						<div class="weui-cell__bd">
							<div class="weui-uploader">
								<div class="weui-uploader__hd">
									<p class="weui-uploader__title">图片上传(最多一张)：</p>
								</div>
								<div class="weui-uploader__bd" style="margin-bottom: 0;margin-right: 0;">
									<ul class="weui-uploader__files" id="uploaderFiles">
									</ul>
								</div>
								<div class="weui-uploader__input-box">
									<input id="uploaderInput" class="weui-uploader__input zjxfjs_file" type="file"
										accept="image/*" multiple="" />
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>

			<div class="weui-cell weui-flex">
				<div class="weui-flex__item middle"><a href="javascript:;" onclick="saveImg()" id="save"
						class="weui-btn weui-btn_mini weui-btn_primary">确认上传</a></div>
			</div>
		</div>
	</div>

	<!--病历中心-->
	<div id="divRecord" class='weui-popup__container'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<div class="weui-cells weui-cells_form recordList" style="overflow:auto; background: #F6F6F9;">
				<div class="weui-cell">
					<div class="weui-cell__bd font14">
						编号：<span class="record_id"></span>
					</div>
					<div class="weui-cell__ft"><a href="javascript:;"
							class="weui-btn weui-btn_mini weui-btn_primary close-popup-btn">关闭</a></div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">付费类型：<span class="pay_type"></span></div>
					</div>
				</div>
				<div class="weui-cell weui-flex">
					<div class="weui-flex__item">
						<div class="font14" style="width:140px">姓名：<span class="patient_name"></span></div>
					</div>
					<div class="weui-flex__item">
						<div class="font14">性别：<span class="patient_sex"></span></div>
					</div>
					<div class="weui-flex__item">
						<div class="font14">年龄：<span class="patientAge"></span></div>
					</div>
				</div>
				<div class="weui-cell weui-flex">
					<div class="weui-flex__item">
						<div class="font14" style="width:140px">电话：<span class="inquiry_patient_phone"></span></div>
					</div>
					<div class="weui-flex__item">
						<div class="font14">婚姻：<span class="is_married"></span></div>
					</div>
					<div class="weui-flex__item">
						<div class="font14">籍贯：<span class="patient_marital_status"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14" style="width:140px">体重：<span class="patient_weight"></span></div>
					</div>
					<div class="weui-cell__hd">
						<div class="font14">职业：<span class="inquiry_patient_profession"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">住址：<span class="inquiry_patient_address"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">药物过敏史：<span class="iinquiry_patient_allergy_details"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">主诉：<span class="log_main_suit"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">现病史：<span class="log_present_illness"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">既往史：<span class="log_history_present_illness"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">诊断：<span class="lof_diagnosis"></span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">问诊日期：<span class="lrsj"></span></div>
					</div>
				</div>
				<div class="weui-cell onlineRecipe">
					<div class="weui-cell__hd">
						<div class="font14">电子处方 <span class="fontRed">（点击下方按钮查看处方）</span><br /><span
								class="prescriptionListC">暂无处方列表</span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">检验检查<span class="fontRed">（点击下方按钮查看检验检查）</span><br /><span
								class="checklistListC">暂无数据</span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">健康指导<span class="fontRed">（点击下方按钮查看健康指导）</span><br /><span
								class="guidanceListC">暂无数据</span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">申请单<span class="fontRed">（点击下方按钮查看申请单）</span><br /><span
								class="formListResultC">暂无数据</span></div>
					</div>
				</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">
						<div class="font14">住院建议<span class="fontRed">（点击下方按钮查看住院建议）</span><br /><span
								class="hospitalizationListC">暂无数据</span></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--病历详情-->
	<div id="divRecordImg" class='weui-popup__container'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<div class="weui-cells weui-cells_form" style="width:100%;height:100%;overflow:auto;margin-bottom: 60px;">
				<div class="weui-cell">
					<div class="weui-cell__bd font14">
						<span class="title"></span>
					</div>
					<div class="weui-cell__ft" id="imgPopClose"><a href="javascript:;"
							class="weui-btn weui-btn_mini weui-btn_primary close-popup ">关闭</a></div>
				</div>
				<div class="weui-cell">
					<img style="width:100%" class="imgShow" />
				</div>
				<!-- <div class="weui-cell">
                <a id="btnBuyOrder" href="javascript:;" class="weui-btn weui-btn_primary">购买处方</a>
            </div> -->
			</div>
		</div>
	</div>
	<!--测量数据填写-->
	<div id="dateWrite" class='weui-popup__container'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<div class="weui-cells weui-cells_form recordList" style="overflow:auto; background: #F6F6F9;height: 100%;">
				<div class="weui-cell">
					<div class="weui-cell__bd font14">测量数据填写</div>
					<div class="weui-cell__ft"><a href="javascript:;"
							class="weui-btn weui-btn_mini weui-btn_primary close-popup-btn">关闭</a></div>
				</div>
				<div style="margin: 0 10px;background: unset;font-size: 14px;">温度</div>
				<div class="weui-cell">
					<div class="weui-cell__hd">体温：</div>
					<div class="weui-cell__bd"><input type="text" class="weui-input" id="dataAnimalHeat" type="number"
							placeholder="请输入体温" />°C</div>
				</div>
				<div style="margin: 0 10px;background: unset;font-size: 14px;">呼吸频率</div>
				<div class="weui-cell weui-flex">
					<div class="weui-cell__hd">呼吸频率：</div>
					<div class="weui-cell__bd"><input type="text" class="weui-input" id="dataRr" type="number"
							placeholder="请输入呼吸频率" />次/分钟</div>
				</div>
				<div style="margin: 0 10px;background: unset;font-size: 14px;">血压</div>
				<div class="weui-cell" style="display: block;">
					<div class="line">
						<div class="weui-cell__hd inline">收缩压：</div>
						<div class="weui-cell__bd inline"><input type="text" class="weui-input" id="dataSbp" type="number"
								placeholder="请输入收缩压" />mmHg</div>
					</div>
					<div class="line">
						<div class="weui-cell__hd inline">舒张压：</div>
						<div class="weui-cell__bd inline"><input type="text" class="weui-input" id="dataDbp" type="number"
								placeholder="请输入舒张压" />mmHg</div>
					</div>
					<div class="line">
						<div class="weui-cell__hd inline">心率：</div>
						<div class="weui-cell__bd inline"><input type="text" class="weui-input" id="dataHeartRate" type="number"
								placeholder="请输入心率" />次/分钟</div>
					</div>
				</div>
				<div style="margin: 0 10px;background: unset;font-size: 14px;">血糖</div>
				<div class="weui-cell" style="display: block;">
					<div class="line">
						<div class="weui-cell__hd inline">血糖：</div>
						<div class="weui-cell__bd inline"><input type="text" class="weui-input" id="dataGlu" type="number"
								placeholder="请输入血糖" />mmol/L</div>
					</div>
					<div class="line">
						<div class="weui-cell__hd inline">测量条件：</div>
						<div class="weui-cell__bd inline" style="position: relative;"><input class="weui-input"
								type="text" value="" id='text2' /><img src="../res/images/icon_open.png"
								class="select_img"></div>
					</div>
					<div class="line">
						<div class="weui-cell__hd inline">测量参考：</div>
						<div class="weui-cell__bd inline"><span>3.61~6.11mmol/L(65~110mg/dl)</span></div>
					</div>
				</div>
				<a class="weui-btn weui-btn_mini f-white" href="javascript:;" onclick="addData()"
					style="font-size: 17px; margin: 0 3%; width: 94%;background-color: #1189ff">录入数据</a>
				<a class="weui-btn weui-btn_mini f-white" href="javascript:;" onclick="historyData()"
					style="font-size: 17px; margin: 0 3%; width: 94%;background-color: #1189ff;">历史数据</a>
			</div>
		</div>
	</div>
	<!--测量历史-->
	<div id="dateHistory" class='weui-popup__container'>
		<div class="weui-popup__overlay"></div>
		<div class="weui-popup__modal">
			<div class="weui-cells weui-cells_form"
				style="width:100%;height:100%;overflow:auto;margin-bottom: 60px;background: #F6F6F9;">
				<div class="weui-cell" style="background-color: #FFFFFF;">
					<div class="weui-cell__bd font14">测量历史</div>
					<div class="weui-cell__ft"><a href="javascript:;"
							class="weui-btn weui-btn_mini weui-btn_primary close-popup-btn">关闭</a></div>
				</div>
				<div class="dataShow  recordList">
					<!-- <div style="width:100%;text-align: center;"></div> -->
				</div>
			</div>
		</div>
	</div>
	<!-- 点击放大图片 -->
	<div class="weui-mask img_mask close_img" style="opacity: 1;"></div>
	<div class="weui-dialog img_dialog close_img" style="opacity: 1;">
		<img class="show" src="">
	</div>
	<!-- 医生离线通知 -->
	<div class="weui-mask doctor_mask" style="opacity: 1;"></div>
	<div class="weui-dialog doctor_dialog" style="opacity: 1;">
		<div class="weui-dialog__bd feeInfoDate">医生网络不佳暂时掉线，建议您等待医生重新连接。若结束问诊，诊查费在1-3个工作日原路返回。您也可以返回首页，选择其他医生。</div>
		<div class="weui-dialog__ft feeInfoSelect">
			<a href="javascript:;" class="weui-dialog__btn default Refeedialog">结束问诊</a>
			<a href="javascript:;" class="weui-dialog__btn primary backIndex">返回首页</a>
			<a href="javascript:;" class="weui-dialog__btn primary toWait">继续等待医生</a>
		</div>
	</div>
	<div class="js_dialog" id="androidDialog1" style="display: none;">
		<div class="weui-mask fee_mask"></div>
		<div class="weui-dialog fee_dialog weui-skin_android">
			<div class="weui-dialog__hd"><strong class="weui-dialog__title">您确认要退诊查费吗?</strong></div>
			<div class="weui-dialog__bd">
				当前问诊费会在1-3个工作日原路返回，请耐心等待
			</div>
			<div class="weui-dialog__ft">
				<a href="javascript:" class="weui-dialog__btn weui-dialog__btn_default">取消</a>
				<a href="javascript:" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
			</div>
		</div>
	</div>
	<div class="darkBackgroud"
		style="width: 100%; height: 100vh;background: rgba(0, 0, 0, 0.3);opacity: 0.3;position: fixed;z-index: 1;top: 0; z-index: 1000;">
	</div>
	<div class="popubBox">
		<div class="titleMessage">您确定要退款吗</div>
		<div class="btnList">
			<div class="btn1">
				退款
			</div>
			<div class="btn2">
				取消
			</div>
		</div>
	</div>
	<div class="popubBox1">
		<div class="titleMessage">本次问诊为视频问诊,需要开启摄像头(麦克风)</div>
		<div class="btnList">
			<div class="btn11">
				确定
			</div>
		</div>
	</div>
</body>

</html>
